﻿<?xml version="1.0" encoding="utf-8" ?>

<sqlMap namespace="WorkflowProcess" xmlns="http://ibatis.apache.org/mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  
  <resultMaps>
    <resultMap id="KPIResult" class="KPI">
      <result property="Id" column="Id" />
      <result property="Name" column="Name" />
      <result property="Value" column="Value" />
      <result property="Start" column="Start" />
      <result property="Stop" column="Stop" />
      <result property="Elapsed" column="Elapsed" />
    </resultMap>
  </resultMaps>

  <statements>

    <select id="SelectAllKPI" resultMap="KPIResult">
      SELECT * from BAM_KPI;
    </select>

    <select id="dynamicGetKPIList" parameterClass="KPI" resultMap="KPIResult" >
      SELECT * from BAM_KPI
      <dynamic prepend="WHERE">
        <isNotNull prepend="AND" property="Id">
          Id=#Id#
        </isNotNull>
        <isNotNull prepend="AND" property="Name">
          Name=#Name#
        </isNotNull>
        <isNotNull prepend="AND" property="Value">
          Value=#Value#
        </isNotNull>
        <isGreaterThan prepend="AND" property="Elapsed" compareValue="0">
          ( Elapsed = #Elapsed# )
        </isGreaterThan>
      </dynamic>
    </select>
  </statements>
</sqlMap>

